package com.item.springsecurity.factory;

/**
 * _______                             __________
 * \      \   _______  __ ___________  \______   \__ __  ____
 * /   |   \_/ __ \  \/ // __ \_  __ \  |    |  _/  |  \/ ___\
 * /    |    \  ___/\   /\  ___/|  | \/  |    |   \  |  / /_/  >
 * \____|__  /\___  >\_/  \___  >__|     |______  /____/\___  /
 * \/     \/          \/                \/     /_____/
 *
 * @Auther: wangdong
 * @Description: TODO <p>工厂模式</p>
 * <p>定义一个用于创建对象的接口，让子类决定实例化哪一个类，工厂方法使一个类的实例化延迟到其子类</p>
 * @Date: 2019/4/25 15:26
 * @Version 1.0
 */
interface CarFactory {
    void getWheel(String type);
}

class Car implements CarFactory{

    @Override
    public void getWheel(String type) {
        System.out.println("这是"+type+"型号轮子");
    }
}

interface ICarFactory {
     CarFactory getCar();
}

class ICar implements ICarFactory{

    @Override
    public CarFactory getCar() {
        return new Car();
    }
}


class main{
    public static void main(String[] args) {

        ICarFactory iCarFactory = new ICar();

        CarFactory carFactory = iCarFactory.getCar();

        carFactory.getWheel("F1");



    }
}